﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WFNetLib.Log;
using Common;
using System.Data;
using fhjlDAL.wfFHJLDataSetTableAdapters;
namespace fhjlBLL
{
    public class 换热站BLL
    {
        SystemLogData l = new SystemLogData();
        public 换热站BLL()
        {
            l.LogType = LogType.信息管理.ToString();            
            l.LogRemark = "换热站";            
        }
        public DataTable Select(换热站Data data)
        {
            换热站TableAdapter adapter = new 换热站TableAdapter();
            fhjlDAL.wfFHJLDataSet.换热站DataTable dt = new fhjlDAL.wfFHJLDataSet.换热站DataTable();
            adapter.Fill(dt,data.SQLType,data.锅炉房ID,data.ID,data.名称);
            return dt;
        }
        public int Insert(换热站Data data)
        {
            换热站TableAdapter adapter = new 换热站TableAdapter();            
            l.LogContent = "新建\"" + data.名称 + "\"信息";
            l.Operator = data.Operator;
            l.InserSQLLog();
            return adapter.InsertQuery(data.名称, data.地址, data.备注, data.IsAvailable, data.Operator, data.AddTime,data.锅炉房ID);
        }
        public int Update(换热站Data data)
        {
            换热站TableAdapter adapter = new 换热站TableAdapter();            
            l.LogContent = "更改\""+data.名称+"\"信息";            
            l.Operator = data.Operator;
            l.InserSQLLog();
            return adapter.UpdateQuery(data.名称, data.地址, data.备注, data.IsAvailable, data.Operator, data.AddTime, data.ID);
        }
        public int Delete(换热站Data data)
        {
            换热站TableAdapter adapter = new 换热站TableAdapter();
            l.LogContent = "删除\"" + data.名称 + "\"信息";
            l.Operator = data.Operator;
            l.InserSQLLog();
            return adapter.DeleteQuery(data.ID);
        }
        public DataTable GetName(Guid ID)
        {
            hrzNameTableAdapter adapter = new hrzNameTableAdapter();
            return adapter.GetName(ID);
        }
    }
}
